//
//  AppDelegate+Extension.m
//  NetClass
//
//  Created by lnd on 2020/3/6.
//  Copyright © 2020 xw. All rights reserved.
//

#import "AppDelegate+Extension.h"
/// 启动占位图
#import "TYLaunchViewController.h"
#import "TYBaseTabBarController.h"
#import "LoginVC.h"
#import "TYBaseNavigationController.h"

@implementation AppDelegate (Extension)


- (void)setWindowAndRootViewController {
    if (!self.window) {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.window.backgroundColor = [UIColor whiteColor];
    }
   
    // 判断用户是否已登录
    if ([WDGlobal isLogin]) {
        [self rootTabBarVC]; // 用户已登录，进入主页
    } else {
        [self toLoginVC]; // 用户未登录，进入登录页面
    }
    [self.window makeKeyAndVisible];
}

- (void)rootTabBarVC {
    self.window.rootViewController = [[TYBaseTabBarController alloc] init];
}

- (void)toLoginVC {
    self.window.rootViewController = [[LoginVC alloc] init];
}

@end

